package com.ie.controller.admin;

import com.ie.common.http.ResponseResult;
import com.ie.common.sercurity.anno.AuthIgrone;
import com.ie.entity.OrdersEntity;
import com.ie.service.admin.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/admin/orders")
public class OdersController {
    @Autowired
    private OrdersService ordersService;

    @AuthIgrone//TODO
    @PostMapping("/getAllOrders")
    public ResponseResult<Map<String, Object>> getAllOrders(@RequestBody OrdersEntity ordersEntity) {
        return ordersService.getAllOrders(ordersEntity);

    }

    @PostMapping("/getOrdersDetail")
    public ResponseResult<List<Map<String, Object>>> getOrdersDetail(@RequestBody OrdersEntity ordersEntity) {
        return ordersService.getOrdersDetail(ordersEntity);
    }

    @AuthIgrone//TODO
    @PostMapping("/submitOrder")
    public ResponseResult<OrdersEntity> submitOrder(@RequestBody OrdersEntity ordersEntity) {
       return ordersService.submitOrder(ordersEntity);
    }
    @AuthIgrone//TODO: 暂时忽略权限
    @PostMapping("/goSubmitOrder")
    public ResponseResult<OrdersEntity> goSubmitOrder(@RequestBody OrdersEntity ordersEntity){
        return ordersService.goSubmitOrder(ordersEntity);
    }
    @AuthIgrone//TODO
    @PostMapping("/getOrdersByUid")
    public ResponseResult<Map<String, Object>> getOrdersByUid(@RequestBody OrdersEntity ordersEntity) {
        return ordersService.getOrdersByUid(ordersEntity);

    }

    @PostMapping("/selectOrderByMonth")
    public ResponseResult<List<OrdersEntity>> selectOrderByMonth(@RequestBody OrdersEntity ordersEntity) {
        return null;
    }

    @PostMapping("/selectOrderByType")
    public ResponseResult<List<Map<String, Object>>> selectOrderByType() {
        return null;

    }
}
